package ch01;

/**
 * 
 * @author Xi Chen
 *
 */

public class Test {
	
	/**
	 * Print all the consecutive numbers
	 * O(n) if k is a constant. O(n^2) if k is a fraction of n
	 * @param k the number of consecutive numbers
	 * @param m the range from 1 .. m
	 */
	public static void printConsecutiveNum(int k, int m) {
		for (int i = 0; i < m - k + 1; i++) {
			for (int j = 0; j < k; j++) {
				System.out.print(i + j + 1);
			}
		}
	}

	public static void main(String[] args) {
		printConsecutiveNum(2, 6);
	}

}
